package
{
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	
	import noiseandheat.flexunit.visuallistener.VisualListener;
	
	import org.flexunit.internals.TraceListener;
	import org.flexunit.runner.FlexUnitCore;
	import org.fluint.uiImpersonation.VisualTestEnvironmentBuilder;
	
	import tests.MattsBotControllerTest;
	
	
	[SWF(backgroundColor="#000000", frameRate="120", width="400", height="300")]
	public class TestRunner extends Sprite
	{
		private var core:FlexUnitCore;
		private var listener:VisualListener;
		
		public function TestRunner()
		{
			core = new FlexUnitCore();
			VisualTestEnvironmentBuilder.getInstance(this);
			
			listener = new VisualListener(400, 300);
			addChild(listener);
			core.addListener(listener);
			core.addListener(new TraceListener());
			
			core.run(MattsBotControllerTest);
			
			addEventListener(Event.ADDED_TO_STAGE, addedToStage);
		}
		
		protected function addedToStage(event:Event):void
		{
			removeEventListener(Event.ADDED_TO_STAGE, addedToStage);
			
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;
		}
	}
}